home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / Gui4Cli / Docs / user / HelpSystem.txt
Encoding:
Text File  |  1980-01-03  |  16.1 KB  |  432 lines

  1. @databse HelpSysDoc
  2. @node Introduction
  3.                   GUI4CLI HELP SYSTEM DOCUMENTATION
  4.  
  5. INTRODUCTION
  6.     FastRead.gc is a complete Gui4Cli help system, which can access
  7. documentation either completely, in reader mode, or by fetching
  8. selected patches of text for online help from within a Gui4Cli user's
  9. own program.
  10.  
  11.     This gives the Gui4Cli user an easier and quicker way than
  12. AmigaGuide to write documentation about his program, and the same
  13. document can also be used for quick help from within the user's own
  14. program, although FastRead.gc can also do these things with AmigaGuide
  15. documents as well as its own, just as easily.
  16.  
  17.     FastRead.gc works in two modes. Firstly it is able to be used as a
  18. document reader, and secondly as quick help from within a program,
  19. fetching and displaying instructions on individual gadgets. It can do
  20. this because it has a separate reader gui, ViewText.g, which displays
  21. the text.  FastRead.gc handles the preprocessing of documents and
  22. displays the index, so is not needed when only online help is
  23. required.  ViewText.g handles this part.
  24. @endnode 
  25.  
  26. @node Requirements
  27. REQUIREMENTS
  28.     The Gui4Cli help system needs no special support libraries or
  29. files, and only needs Gui4Cli installed on the system. The work is
  30. done by two binary files, GetNodes and WriteNode, which are a part of
  31. the Gui4Cli distribution.
  32. @endnode 
  33.  
  34. @node "Where Things Are"
  35. THE FASTREAD DIRECTORY TREE
  36.     Until you are familiar enough with FastRead.gc and its associated
  37. programs to be able to take it and use it for your own purposes, you
  38. may find it helpful to know where things are in relation to your
  39. overall directory structure. You need Gui4Cli to be installed in your
  40. system, and it will use the directory GUIS: as its home base. Within
  41. that environment, FastRead.gc and its friends are located thus :
  42.  
  43.   GUIS:                      ;Home base for Gui4Cli
  44.     |
  45.     |___Docs                 ;Gui4Cli directory for documents. eg,
  46.     |                        ;HelpSystem.txt (the file you are
  47.     |                        ;reading now), plus any further docs,
  48.     |                        ;guides, etc. which you collect or 
  49.     |                        ;create.
  50.     |
  51.     |___C                    ;Gui4Cli directory for binaries. GetNodes
  52.     |                        ;and WriteNode are stored in here.
  53.     |
  54.     |___Tools                ;Gui4Cli directory for global tools, such
  55.           |                  ;as FastRead.
  56.           |
  57.           |___FastRead       ;FastRead.gc, ViewText.g, HelpDemo.gc
  58.                   |          ;and related icons.
  59.                   |
  60.                   |___Idx    ;Directory to hold index files as
  61.                              ;created by FastRead.gc.
  62. @endnode
  63.  
  64. @node "The GCHELP: Assign"
  65. THE GCHELP: ASSIGN
  66.     For general convenience, the directory name GCHELP: is temporarily
  67. assigned to whatever directory holds FastRead.gc or any of its
  68. associated programs. The assignment is created by the FastRead.gc
  69. suite of programs when any of them start up, and is removed again when
  70. the programs end. The assign will have no effect on anything else you
  71. do.
  72. @endnode 
  73.  
  74. @node "Writing Your Docs"
  75. WRITING A DOCUMENT
  76.     As with AmigaGuide, the doc file is written in any text editor.
  77. The difference is that unlike AmigaGuide, the Gui4Cli help system does
  78. not require the insertion of complex formatting codes. Only three
  79. codes are used - '@node' and '@endnode', to mark the start and end of
  80. various topics that the user wants to access, and a '@database'
  81. header. These are the same markers as AmigaGuide uses. FastRead.gc
  82. will strip out all other AmigaGuide formatting codes when reading
  83. AmigaGuide. Text colours and styles are not supported, since the
  84. handling of AmigaGuides by FastRead.gc is there merely to enable the
  85. user to write his docs in either format and still have access to
  86. online help.
  87.  
  88.     A document which is intended for access by FastRead.gc needs some
  89. preparatory editing. The file you are now reading has examples of such
  90. editing included. Each section of text which you want to appear in the
  91. index must begin with '@node' and end with '@endnode'. It's as simple
  92. as that. A short title must be placed after '@node'. This is the
  93. subject title which will appear in the FastRead lister.  If the title
  94. contains spaces, enclose it in double quotes. The same applies to the
  95. database title.
  96.  
  97.     For the purposes of this text, let the | character represent the
  98. extreme left of your editing window. Then the layout of your document
  99. might look like this :
  100.  
  101.     |@database <title>
  102.     |@node Introduction
  103.     |
  104.     |(Introductory text)
  105.     |
  106.     |@endnode
  107.     |
  108.     |@node "Contacting the author"
  109.     |
  110.     |(Text about the author)
  111.     |
  112.     |@endnode
  113.  
  114. The first line in a document must be a '@database' statement, and the
  115. last line an endnode statement.
  116. @endnode
  117.  
  118. @node "The Index File"
  119. THE INDEX FILE
  120.     When your document has been written, and FastRead.gc reads this or
  121. an AmigaGuide file for the first time, an index file will be created
  122. automatically, and stored in the 'GUIS:Tools/FastRead/Lst' drawer.
  123.  
  124.     The name of the index file will always be the same as the document
  125. it belongs to, with a '.idx' filename extension added. For example, if
  126. your document was called 'MyDoc.guide', the index file would be
  127. created with the name 'MyDoc.guide.idx'.
  128.  
  129.     The index file is used in the FastRead.gc lister, and it's
  130. contents will look something like this...
  131.  
  132. Introduction                            38 1047
  133. Requirements                            1114 245
  134. ...
  135.  
  136.     The numbers are the start and length offsets of the subject text
  137. in bytes, so that FastRead.gc will know where to go to retrieve the
  138. text. These numbers are hidden in the lister, and are used also for
  139. online help within the users program.
  140. @endnode
  141.  
  142. @node "   Index Format"
  143. FORMATTING THE INDEX
  144.     If your text naturally divides itself into major topics and
  145. subtopics, then subtopics can be indicated by preceding the node
  146. title with, say, three spaces, placed INSIDE the double quotes which
  147. enclose the node title, thus :
  148.  
  149.     |@node "   Requirements"
  150.  
  151. The exact number of spaces doesn't matter, but you must be consistent.
  152.  
  153.     You can indicate sub-subtopics in a similar way. The number of
  154. spaces must be more than the number used for the preceding level, and
  155. should be consistent... 
  156.  
  157.      |@node Introduction
  158.      |(text .. any number of lines)
  159.      |@endnode 
  160.      |@node Applications
  161.      |(text)
  162.      |@endnode 
  163.      |@node "   Application 1"
  164.      |(text)
  165.      |@endnode 
  166.      |@node "      Refinements A"
  167.      |(text)
  168.      |@endnode 
  169.      |@node "      Refinements B"
  170.      |(text)
  171.      |@endnode 
  172.      |@node "   Application 2"      
  173.      |(text)
  174.      |@endnode 
  175.      |@node Limitations
  176.      |(text)
  177.      |@endnode 
  178.  
  179.     Note that the subject titles that do not need formatting, and only
  180. consist of one word, have no quotes enclosing them. It would do no
  181. harm to put these node titles in quotes, but would be pointless. The
  182. quotes MUST be there for the other titles in the above example.
  183. @endnode 
  184.  
  185. @node "The Programs"
  186. THE PROGRAMS
  187.     FastRead.gc is the document reader itself, and can work in two
  188. modes. Stand alone, which will read a whole doc file, and Online,
  189. which fetches selected patches of text, or topics from the doc file.
  190. In Stand Alone mode, FastRead.gc does not need the user's program to
  191. be running, and becomes a text file reader. In Online mode, the
  192. commands to fetch text are sent from the user's program instead of
  193. FastRead.gc.
  194.  
  195.     ViewText.g is the part of FastRead that actually displays the
  196. text, and runs without FastRead.gc for online help, being controlled
  197. from the user's program.
  198.  
  199.     HelpDemo.gc is a 'mock up' of the user's program, intended to
  200. demonstrate how FastRead.gc is used from within a Gui4Cli script to
  201. obtain online help.
  202. @endnode 
  203.  
  204. @node "   The Binaries"
  205.                              THE BINARIES
  206.  
  207. GetNode:        Usage: GetNodes <source doc> <.idx file>
  208.  
  209.     This is the program that creates the index file (.idx) for your
  210. documentation. GetNodes will grab all the node titles in your doc and
  211. calculate the starting byte and length of each one. The .idx file is
  212. laid out like this...
  213.  
  214. --- Title --------------------------- Start & Length -----
  215.  
  216. Introduction                            38 1047
  217. Requirements                            1114 245
  218. ...
  219.  
  220. WriteNode:      Usage: WriteNode <document> <start> <length>
  221.  
  222.     WriteNode uses the start and length numbers in the .idx file
  223. generated by GetNodes to find and grab the required piece of text from
  224. your document. The piece of text is saved to Ram Disk:, and is always
  225. called 'Guide.txt'.
  226. @endnode
  227.  
  228. @node "   FastRead.gc"
  229. FASTREAD.GC
  230.     This is the actual text reader. FastRead.gc opens two windows when
  231. in Stand Alone mode, the main window with a lister, containing the
  232. various topics and subtopics of the doc file, and the text window,
  233. which displays the actual text of the topic or subtopic.
  234.  
  235.     On loading, FastRead.gc presents a file requester from which the
  236. doc file to be read is chosen. After the file has been chosen, the
  237. lister will display the topics and subtopics. A new document can be
  238. loaded at any time via the 'Open' button.
  239.  
  240.     Clicking with the left mouse button on any topic or subtopic will
  241. bring the text window to the front and display the text. A right mouse
  242. button click brings the lister back to front, and clears the text
  243. window, ready for another topic to be selected. To Quit FastRead.gc,
  244. simply close either of the windows with their close gadget. 
  245.  
  246.     A simple lister search facility is included. This consists of a
  247. string gadget at the top, with a button marked [»] next to it. This
  248. can be useful for very large documents, or for AmigaGuides which
  249. contain hundreds of nodes. By typing any character string into the
  250. string gadget, the first index item which matches will move to the top
  251. of the lister. The search is not case sensitive. For example, the
  252. 'Requirements' index item can be found in a long list by typing 'req,
  253. REQ, or reQ' into the string gadget. Clicking on the button marked [»]
  254. will move the next matching index item to the top of the lister.
  255.  
  256.     Pressing the HELP key whilst the FastRead.gc lister window is
  257. active will load and display this text. Any document being read at the
  258. time will be kept and not need to be reloaded.
  259.  
  260.     FastRead understands one icon tooltype - VTMACRO, which sets the
  261. default AmigaDOS or ARexx script to run when the [Macro] button is
  262. pressed in the ViewText window.
  263. @endnode 
  264.  
  265. @node "   ViewText.g"
  266. VIEWTEXT.G
  267.     This is the text window part of FastRead.gc, but is a global file
  268. which can be used by either FastRead.gc or the user's program, and is
  269. used without FastRead.gc for online help. All calls concerning online
  270. help are made from the users program. ViewText.g is initially loaded
  271. from there, and displays the specific text patch requested. See the
  272. section on HelpDemo.gc for more information.
  273.  
  274.     When the patch of text has been read, a click on the right mouse
  275. button closes ViewText.g. The ViewText.g window has a button strip
  276. along the top to the right, containing four buttons. These are
  277. described as follows...
  278.  
  279. Macro - Opens a file requester and enables an AmigaDOS or ARexx script
  280.         to be run. If the VTMACRO tooltype is set in FastRead's icon,
  281.         this macro will run without opening the requester.
  282.  
  283. Prev - This goes to the previous subject in the FastRead.gc lister and
  284.        displays it. When displaying online help, this button is
  285.        ghosted.
  286.  
  287. Next - This goes to the next subject in the FastRead.gc lister and
  288.        displays it. When displaying online help, this button is
  289.        ghosted.
  290.  
  291. Grab - Saves the piece of text currently being displayed in the
  292.        ViewText.g listview. A file requester will appear for the save
  293.        path and filename. This function is also accessible by pressing
  294.        CTRL-S.
  295.  
  296. Quit - This quits completely when used in stand alone mode, for
  297.        reading complete documents. However, in online mode, the Quit
  298.        button simply closes the Viewtext.g window. This function is
  299.        also accessible by pressing CTRL-Q.
  300. @endnode 
  301.  
  302. @node "   HelpDemo.gc"
  303. HELPDEMO.GC
  304.     This is a 'mock up' used to simulate the user's program, and to
  305. demonstrate how to get selected patches of text from the program's doc
  306. file to use as online help.
  307.  
  308. HelpDemo.gc can be read in any text editor or viewer. (Recommended)
  309.  
  310. Borrowing parts of HelpDemo.gc for your own project
  311. ===================================================
  312.  
  313. Loading ViewText.g - After 'xOnLoad' are the lines...
  314.  
  315.     extract fastread.gc guipath fre_path
  316.     assign GCHELP: $fre_path
  317.     delvar fre_path
  318.  
  319. This grabs the path of HelpDemo.gc and makes a temporary assign. The
  320. full path of ViewText.g is GUIS:Tools/FastRead/ViewText.g, but the
  321. GCHELP: assign is used throughout for convenience. The next important
  322. line is...
  323.  
  324.       GuiLoad GCHELP:ViewText.g
  325.  
  326.     This loads ViewText.g without opening its window. Put a copy of
  327. that line in a similar position in your program.
  328.  
  329. Specify your document - In the script of HelpDemo.gc you will find:
  330.  
  331.      ; -----  The target document is named here ----
  332.      docname = GUIS:Docs/HelpSystem.txt
  333.  
  334.     This puts the path and filename of the document into a variable
  335. called 'docname'. Include the same in your program, changing
  336. 'GUIS:Docs/HelpSystem.txt' to your document's path and filename.
  337.  
  338.     Switching help mode on and off is done in this case by a checkbox,
  339. but can be done by almost any gadget you like. Near the top of the
  340. script is the line...
  341.  
  342.     helpon = 0
  343.  
  344. which sets the helpmode to off. It will remain off until the checkbox
  345. is selected. The 'helpon' variable is used later to test whether help
  346. has been switched on or off.
  347.  
  348. Assign topics to gadgets - Find the patch of script which contains
  349.  
  350.     ; ---- The button for the HelpDemo patch ----
  351.  
  352.     This is where you will need the '.idx' file which belongs to your
  353. document. The index file is not actually used with online help, but
  354. the byte offset numbers that it contains are used to locate the text
  355. patch in your document. You will see the lines...
  356.  
  357.     offset = "8639 1992"
  358.     gosub helpdemo.gc open
  359.  
  360.     The actual numbers are not important here, since they will be the
  361. ones in the .idx file belonging to your document.
  362.  
  363.     The first line puts the start and length offsets into a variable
  364. called offset. This variable is used later in the script by a
  365. subroutine called 'open', which does the biz. The second of the two
  366. lines jumps to the 'open' subroutine.
  367.  
  368.     At the bottom of the HelpDemo.gc script you will see the
  369. subroutine as follows...
  370.  
  371. ; ---------- This is the routine for opening the reader gui...
  372.  
  373.     xroutine open
  374.     if $helpon = 0
  375.         return
  376.     elseif $helpon = 1
  377.         cli 'GUIS:C/WriteNode $docname $offset'    
  378.         guiopen viewtext.g
  379.         guiwindow viewtext.g front
  380.         lvuse viewtext.g 1
  381.         lvchange ram:guide.txt
  382.         stop
  383.     endif
  384.  
  385. This subroutine is shared by all the gadgets that use online help. To
  386. go through it line by line...
  387.  
  388.     if $helpon = 0
  389.         return    
  390.  
  391.     If the helpmode has not yet been activated, go back to the routine
  392. of the gadget that called the 'open' subroutine and carry out any
  393. commands remaining there.
  394.  
  395.     elseif $helpon = 1
  396.         cli 'GUIS:C/WriteNode $docname $offset'    
  397.  
  398.     Alternatively, if the helpmode has been activated, run the
  399. WriteNode binary in GUIS:C, and send to it the document path and
  400. filename, and the offset (start and length) numbers.
  401.  
  402.     WriteNode will grab the required text from the document, and
  403. create a file in the Ram Disk: called 'Guide.txt' which contains the
  404. text. See the section on the binaries for more information.
  405.  
  406.       1  guiopen viewtext.g
  407.       2  guiwindow viewtext.g front
  408.       3  lvuse viewtext.g 1
  409.       4  lvchange ram:guide.txt
  410.       5  stop
  411.  
  412. 1 - Open the reader window. 2 - Bring it to the front. 3 - Select its
  413. listview as the current one. 4 - Import the file 'Ram Disk:Guide.txt'
  414. into the listview and display it. 5 - Halt all operation and wait for
  415. the user. Read the HelpDemo.gc script for more information.
  416. @endnode 
  417.  
  418. @node "Rogues' Gallery"
  419. AUTHORS
  420.     The Gui4Cli Help System was written as a joint project between
  421. Graham Maddox of the UK and John Collett of New Zealand.
  422.  
  423. Graham Maddox - The concept and all Gui4Cli scripts.
  424. <gmaddox@netcentral.co.uk>
  425.  
  426. John Collett - Document format concept and most of the development.
  427. <jcollett@waikato.ac.nz>
  428.  
  429. Dimitris C. Keletsekis - Kindly supplied the binary engines.
  430. <dck@hol.gr>
  431. @endnode 
  432.